package com.zsrt.java.day20161230.wrl.demo02;

public class Student02 {
	
	private int age;
	
	private char sex;
	
	/**
	 * 设置限制：1<=age<=120
	 * @param age	年龄
	 */
	public void setAge(int age) {
		if(1<=age && age<=120){
			this.age = age;
		}
	}
	
	public int getAge() {
		return age;
	}

	public char getSex() {
		return sex;
	}

	/**
	 * 设置性别限制：男和女
	 * @param sex
	 */
	public void setSex(char sex) {
		if(sex=='男'||sex=='女'){
			this.sex = sex;
		}
	}
	
	@Override
	public String toString() {
		return "Student02 [age=" + age + ", sex=" + sex + "]";
	}

}
